/**
 * api接口统一管理
 */
import baseUrl from "@/tools/baseUrl.js"; // 导入接口域名列表
import instance from "@/tools/instance.js"; // 导入http中创建的axios实例
import qs from "qs"; // 根据需求是否导入qs模块
//3.1.2首页
export const getCodeApi = (params) => {
  return instance.get(`${baseUrl.lot}/random/image`, {
    responseType: "blob",
  });
};
//登录
export const loginApi = (params) => {
  return instance.post(`${baseUrl.lot}/login`, qs.stringify(params), {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
  });
};
//注销
export const logoutApi = (params) => {
  return instance.post(`${baseUrl.lot}/logout`, qs.stringify(params), {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
  });
};
// 开关接口
export const lot_onOff_set_api = (params) => {
  return instance.post(`${baseUrl.smartiot}/lot/onOff/set`, params, {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
};
// 设备分页查询
export const lot_equipment_page_api = (params) => {
  return instance.post(`${baseUrl.smartiot}/lot/equipment/page`, params, {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
};
//	区域列表
export const lot_area_list_api = (params) => {
  return instance.post(`${baseUrl.smartiot}/lot/area/list`, params, {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
};
// 设备控制分页查询
export const lot_mark_query_api = (params) => {
  return instance.post(`${baseUrl.smartiot}/lot/mark/query`, params, {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
};
// 查询设备控制
export const lot_equipmentControl_status_api = (params) => {
  return instance.post(
    `${baseUrl.smartiot}/lot/equipmentControl/status`,
    params,
    {
      headers: {
        "Content-Type": "application/json;charset=UTF-8",
      },
    }
  );
};
// 规则分页查询
export const lot_rule_page_api = (params) => {
  return instance.post(`${baseUrl.smartiot}/lot/rule/page`, params, {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
};

// 规则启停
export const lot_rule_onOffSingle_api = (params) => {
  return instance.post(`${baseUrl.smartiot}/lot/rule/onOffSingle`, params, {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
};
// 发送设备控制
export const lot_equipmentControl_control_api = (params) => {
  return instance.post(
    `${baseUrl.smartiot}/lot/equipmentControl/control`,
    params,
    {
      headers: {
        "Content-Type": "application/json;charset=UTF-8",
      },
    }
  );
};
